# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Matt Smith <mcs@darkregion.net>
# Maintainer: Matt Smith <mcs@darkregion.net>
pkgname=apache2-mod-perl
_pkgreal=mod_perl
pkgver=2.0.13
pkgrel=1
pkgdesc="Perl Module for Apache2"
url="https://perl.apache.org/"
arch="all"
license="Apache-2.0"
depends="apache2"
depends_dev="$pkgname"
makedepends="apache2-dev perl-dev perl-linux-pid apr-dev apr-util-dev"
options="!check" # fails to start test server
subpackages="$pkgname-dbg $pkgname-doc $pkgname-dev"
source="https://archive.apache.org/dist/perl/$_pkgreal-$pkgver.tar.gz
	$pkgname.conf"
builddir="$srcdir/$_pkgreal-$pkgver"

build() {
	perl Makefile.PL \
		INSTALLDIRS=vendor \
		MP_APXS=/usr/bin/apxs
	make
}

check() {
	make test
}

package() {
	make DESTDIR="$pkgdir" install
	find "$pkgdir" \( -name perllocal.pod -o -name .packlist \) -delete
	install -Dm644 "$srcdir"/$pkgname.conf \
		"$pkgdir"/etc/apache2/conf.d/$_pkgreal.conf
}

dev() {
	default_dev

	mv "$pkgdir"/usr/bin "$subpkgdir"/usr

	mkdir -p "$subpkgdir"/usr/lib/perl5/vendor_perl/auto/Apache2
	mv "$pkgdir"/usr/lib/perl5/vendor_perl/auto/Apache2/Build \
		"$pkgdir"/usr/lib/perl5/vendor_perl/auto/Apache2/typemap \
		"$subpkgdir"/usr/lib/perl5/vendor_perl/auto/Apache2
}

sha512sums="
453c789743487e2d1167d005f21ef9780f36488db8830103e4ea0a0656f685bf5ec423cd1baa68ee30efc75d9e2b845c9656458203b9f48de81a315a91d587c9  mod_perl-2.0.13.tar.gz
15a430ce597e370997a08d6aa1b5e55d4fa723ecac031fe39906c8cc767b90d5bf63e3026dfaa8b10ae8b09a17832f4f07cb8b2fdcd6c9ef427edfaf4e8a48b0  apache2-mod-perl.conf
"
